package com.ysd.twocrm.controller;

import com.ysd.twocrm.entity.EmailUtils;
import com.ysd.twocrm.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emails")
public class EmailsController {
    @Autowired
    private MailService mailService;
    /*
     * @Description 发送邮件，如果发送成功就返回success，失败就返回false
     * @param em
     * @return java.lang.Object
     * @author liusupeng
     * @date 2020/5/19 14:37
     */
    @GetMapping
    public Object InsertMail(EmailUtils em){

        try {
            mailService.sendMail(em);
            return "success";
        }catch (Exception e){
            return "false";
        }
    }
}
